{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑回收故障</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">故障名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="recycle_name" lay-verify="required" placeholder="故障名称" class="layui-input" value="{$recycle.recycle_name}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">品牌：</label>
                            <div class="layui-input-block">
                                <select name="recycle_brand_id" lay-search="" id="brand_id"  lay-filter="brand_id">
                                    <option value="">---- 请选择品牌 ----</option>
                                    {foreach name="brand" item="vo"}
                                    <option value="{$vo.brand_id}" {$vo.brand_id == $recycle.recycle_brand_id ? 'selected' : ''}>{$vo.brand_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">型号：</label>
                            <div class="layui-input-block">
                                <select name="recycle_models_id" lay-search=""  id="models_id"  lay-filter="models_id">
                                    <option value="">---- 请选择型号 ----</option>
                                    {foreach name="models" item="vo1"}
                                    <option value="{$vo1.models_id}" {$vo1.models_id == $recycle.recycle_models_id ? 'selected' : ''}>{$vo1.models_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">排序：</label>
                            <div class="layui-input-block">
                                <input type="text" name="recycle_sort" lay-verify="required" placeholder="排序" class="layui-input" oninput="value=value.replace(/[^\d]/g,'')" value="{$recycle.recycle_sort}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 form-group">
                            <label class="layui-form-label">是否功能选项：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="recycle_is_more" value="1" title="是" {$recycle.recycle_is_more == 1 ? 'checked' : ''}>
                                <input type="radio" name="recycle_is_more" value="2" title="否" {$recycle.recycle_is_more == 2 ? 'checked' : ''}>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 form-group">
                            <label class="layui-form-label">状态：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="recycle_status" value="1" title="上架" {$recycle.recycle_status == 1 ? 'checked' : ''}>
                                <input type="radio" name="recycle_status" value="2" title="下架" {$recycle.recycle_status == 2 ? 'checked' : ''}>
                            </div>
                        </div>

                        <input type="hidden" value="{$recycle_id}" name="recycle_id">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}

<script>
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('recycleEdit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('Recycle/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>

</body>
</html>
